Hydrocarbon exploration and recovery rely on sophisticated means of reservoir modeling. Reservoir models can be used to understand geology and fluid flow, or predict future production using a variety of recovery mechanisms. General-purpose reservoir simulators are used to integrate geologic, petrophysical, fluid and well model descriptions with physical laws governing mass transport to support reservoir analysis and prediction. A good primer on the principles behind reservoir simulation is Aziz, K. and Settari, A., Petroleum Reservoir Simulation. Elsevier Applied Science Publishers, London (1979). Reprinted by Khalid Aziz and Antonin Settari, Blitzprint Ltd., Calgary, Alberta (2002).
Simulation of reservoir models requires solution of equations which govern conservation of mass and energy over time. The process of simulation involves solving the equations over discrete time intervals to monitor changes in reservoir properties. The equations incorporate transport, phase behavior, and reaction relationships from the petrophysical and fluid models. Spatial variations in reservoir properties require the equations to be spatially discretized in a way that corresponds to the grid geometry and topology. Time dependent terms require temporal discretization to monitor the accumulation of mass or energy at grid node locations throughout the reservoir. Spatial discretization methods are selected to ensure accurate representation of grid property heterogeneities.
Classical node-centered finite difference methods are common for reservoirs with continuous geology and mildly varying permeability. Variants of finite differences are used for grids associated with highly heterogeneous permeability fields. Complex geologic and fluid descriptions can result in a system of equations with millions of equations and unknowns. Stable Newton-like iterative methods are used to solve the nonlinear system and require efficient methods to build and solve the linear system. Adaptive implicit methods can be used to increase the computation efficiency of the Newton iterations by reducing the number of implicit variables and hence the size of the linear system. Young, L. C. and Russell, T. F.: “Implementation of An Adaptive Implicit Method”, SPE paper 25245, presented at the SPE Reservoir Simulation Symposium, New Orleans, 1993. Selection of implicit and explicit nodes is designed to minimize the number of implicit nodes while ensuring the maximum stable timestep size. Cao, H. and Aziz, K.: “Performance of IMPSAT and IMPSAT-AIM Models in compositional simulation”, SPE paper 77720, presented at the SPE ATCE, San Antonio, 2002. Current generation reservoir simulating architectures typically have a lifespan of at least 10 years. As a result, many of the simulators in widespread use have their roots in petroleum engineering, software engineering, and computing technologies that were originally targeted at structured grids and scalar architectures. Advances in software and hardware technologies, parallel computing, advanced gridding, and modern software engineering techniques have created new opportunities. At the same time, evolving workflows involving complex geological models, enhanced rock and fluid property models, large full-field simulations, near well studies, production and facilities optimization, and stochastic modeling have placed new demands on reservoir simulation technology.
Traditional languages, such as FORTRAN, used for the development of reservoir simulators have limited data modeling capability and are focused on following a set of predefined procedures to solve problems. More modern programming languages, such as C++, provide complex data modeling through an advanced data type system and are not limited to decomposing problems in terms of procedures. Additionally, C++ supports object-oriented paradigms which allow development of programs that integrate many components, having widely different behavior, data models, and performance requirements, while providing mechanisms for code reuse, maintainability and extendibility. These elements are critical to the success of a next generation reservoir simulator.
Although object-oriented design has been the main staple of software development for quite some time, its application to scientific programming has been hindered somewhat by the perceived inefficiency of run-time polymorphism. However, in recent years the emergence of compilers that are in full compliance with the C++ standard has made use of generic programming techniques commercially practical. Generic programming offers the benefits of encapsulation and code reuse without the overhead of virtual function calls. Austern, M. H.: Generic Programming and the STL—Using and Extending the C++ Standard Template Library, Professional Computing Series. Addison-Wesley, 1999. Alexandrescu, A.: Modern C++ Design: Generic Programming and Design Patterns Applied, Addison-Wesley, 2001. Object-oriented and generic programming techniques using C++ have been shown to be useful in the development of scientific and numerical applications. Barton, J. and Nackman, L.: Scientific and Engineering C+″, Addison-Wesley, 1994.
Large-scale object-oriented frameworks for scientific computing have been developed in many contexts Henderson, M., Anderson, C., and Lyons, S. (eds): “Object oriented methods for interoperable scientific and engineering computation”, Society for Industrial and Applied Mathematics, 1999. Parallelism has been addressed for example in the POOMA project. Oddham, J., “Scientific Computing Using POOMA”, C++ Users Journal, November 2002. Object-oriented architectures for flow simulations have been developed in other industries. Langtangen, H. P.: Computational Partial Differential Equations, Numerical Methods and Diffpack Programming, Lecture Notes in Computational Science and Engineering, Springer-Verlag, 1999. These techniques have been applied to reservoir simulators by several practitioners within academia. Verma, S. and Aziz, K., “FLEX: an Object-Oriented Reservoir simulator,” SPE paper 36007, presented at the Petroleum Computer Conference, Dallas, 1996. Verma, S.: “Flexible Grids for Reservoir Simulation”, PhD Thesis, Department of Pet. Eng, Stanford University, 1996. Byer, T. J., Edwards, M. G. and Aziz, K.: “A Preconditioned Adaptive Implicit Method for Reservoirs with Surface Facilities,” SPE paper 51895, presented at the SPE Reservoir Simulation Symposium, Houston, 1999. Nogaret, C., “Implementation of an Network-based Approach in an Object-Oriented Reservoir Simulator,” Msc Thesis, Department of Pet. Eng., Stanford University, 1996. Parashar, M., Wheeler, A., Pope, G., Wang, K., Wang, P.: “A New Generation EOS Compositional Reservoir Simulator: Part II-Framework and Multiprocessing”, SPE paper 37977, presented at the Reservoir simulation Symposium, Dallas, 1997. Also, these techniques have been applied in industry. Beckner, B. L., Hutfilz, J. M., Ray, M. B. and Tomich, J. F., “EMpower: New Reservoir Simulation System”, paper 68116, presented at the SPE Middle East Oil show, Bahrain, 2001.
As new software development technologies are invented it is often the case that architectures that adopt these technologies first suffer for a variety of reasons. While the C++ language provides full support for object-oriented paradigms, a deep understanding of many concepts and techniques coupled with years of study and experiments are required to successfully design reservoir simulation architecture. The misuse of inheritance, a technique commonly associated with code reuse and extendibility, often leads to unnecessary complexity and a low rate of code reuse with increasing program requirements.
In traditional scientific programming languages, such as FORTRAN, the type system only supports basic types such as characters, integers, doubles, and arrays of the basic types. The C++ type system provides the ability to create user-defined types referred to as classes. Classes can be designed to contain data as well as methods for operating on the data. Classes define the structure of a type. Objects are instances of classes that contain the data and interact with other objects through composition and inheritance features of the language.
Inheritance among classes is based on an “is-a” relationship between a base class and a derived class. FIG. 1 shows a simple example of inheritance for a framework modeling device types in a pipe flow network program. The triangle symbol represents the inheritance from the base class to the derived class. The derived classes of network classes include Pipe, Valve, and Pump. These derived classes inherit features of the base class NetworkDevice. When a derived class inherits from a base class, all the functions and data members are inherited, although they may not all be accessible by the derived class. Code reuse is achieved through design of the base class, which defines the data and methods accessible by the derived classes. Additionally derived classes may be allowed to override base class methods to extend the behavior of an object. This means that class hierarchies that are designed to interact with NetworkDevice classes can support the addition of new derived classes without modification.
While the “is-a” relationship provides a simple rule for classification and results in rapid development of class hierarchies, as functional requirements of the program expand reliance heavily on inheritance can result in complex hierarchies that are difficult to reuse or extend. For example, a general-purpose pipe flow network program requires that devices can be connected to one another and that the network pressure drop be computed. However, determining the pressure drop between devices requires specific knowledge of the device types. FIG. 2 shows how the class hierarchy would be defined using inheritance where it is assumed that connection classes have access to the collection of NetworkDevice objects. The connection classes are labeled according to the type of devices connected. An ordered collection of DeviceConnection objects is traversed to compute the system pressure drop without specific knowledge of the connection types. Now assume that the system temperature change needs to be computed and that some devices can compute temperature either with approximate or rigorous methods. The updated class hierarchy is shown in FIG. 3 where specialized classes are labeled according to the type of devices connected and the method for computing temperature, APM (approximate) or RGM (rigorous). The architecture is modified so that base and derived classes contain an additional compute method (delta_temp( )) and additional derived classes are implemented for those devices that support the two ways of computing temperature.
This example highlights several problems with inheritance based class hierarchies. First, the derived classes of DeviceConnection combine concepts of type of connection with computation type. For example, one type of connection is a “PipeToPipe” device connection. This type of connection is combined with the compute type (APM and RGM label). As a result of the combining of these concepts of physical type and compute type in derived classes, a disadvantageous complexity is created. The addition of new device and compute types will result in a combinatorial growth in the number of DeviceConnection derived classes and lead to an overly complex architecture. This could be avoided by placing limits on the number of device and compute types but the architecture cannot then be considered extendable.
Furthermore, while the same class structure is used to add new devices and compute types, the DeviceConnection architecture is not extendable without modification. The decision to include system behavior methods such as pressure and temperature change (i.e., delta_pres( ) and delta_temp( ) methods) directly in the hierarchy defining device connectivity (i.e., the class PipeToPipe defines a connection between two pipe devices) results in modifications to the DeviceConnection base class with the addition of new behaviors and leads to potentially monolithic base classes.
The use of inheritance-based architectures is found in previous reservoir simulator architectures such as in the programs of Nogaret and Verma, which were cited above. The architectures employ specialized connection classes that include variants for reservoir cell to reservoir cell, reservoir cell to well cell, or well cell to network device. Due to the research nature of the codes, provisions for computational options such as adaptive implicit, required of commercial simulators, were not included in the class hierarchy and thus limited the number of specialized connection classes.
U.S. Pat. No. 6,928,399 to Watts et al. employs the use of an inheritance-based architecture for reservoir simulation. CellGroups and ConnGroups are taught which are generalizations of the concepts taught by Nogaret and Verma. As an example, the ConnGroup class hierarchy is described and relies on inheritance wherein specialized classes combine multiple concepts, similar to the above example hierarchy in FIG. 3. In this particular case, the connection group class is labeled in terms of the model type (3 variants Well, Reservoir, and Facility) and solution type (3 variants-IMPES-IMPES, Fully-implicit-fully implicit and IMPES-fully implicit). This provides a combinatorial possibility of 3×3 or 9 connection group types. With addition of new models types such as aquifers or specialized reservoir models for dual porosity systems, along with additional solution types such as IMPSAT-fully-implicit, IMPSAT-IMPSAT, IMPSAT-IMPES, it will be appreciated that a combinatorial growth of ConnGroup specializations is likely with the inheritance based architecture.
There is a need for a parallel scalable reservoir simulation program based on an adaptable architecture containing a unified treatment of structured and unstructured grids which overcomes the limitations and problems associated inheritance based architectures. The present invention provides solutions to the above cited shortcomings.